package org.come.xingpan;

import org.come.Frame.TestpackJframe;
import org.come.Frame.ZhuFrame;
import org.come.entity.Goodstable;
import org.come.until.GoodsListFromServerUntil;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * 魂归物品监听
 * <p>
 * Title : MouseListenerSoulBack
 * </p>
 *
 * @author : HGC
 * @date : 2019年8月8日 上午9:24:00
 * @version : 1.0.0
 */
public class MouseListenerSoulBack extends MouseAdapter {

    private int i;
    private JpanelXingBackMain JpanelXingBackMain;

    public MouseListenerSoulBack(int i, JpanelXingBackMain JpanelXingBackMain) {
        this.i = i;
        this.JpanelXingBackMain = JpanelXingBackMain;
    }

    @Override
    public void mousePressed(MouseEvent e) {
        // 选中物品
        Goodstable starCardGoods = GoodsListFromServerUntil.getStarCardGoods(i);
        if (starCardGoods != null && JpanelXingBackMain != null) {
            if (starCardGoods.getStatus() == 1) {
                ZhuFrame.getZhuJpanel().addPrompt2("该星卡已装备，无法魂归");
                return;
            }
            if (starCardGoods.getGoodlock() == 1) {
                ZhuFrame.getZhuJpanel().addPrompt2("该星卡已上锁，无法魂归");
                return;
            }
//            JpanelXingBackMain.addListNum(starCardGoods);
        }
    }

    @Override
    public void mouseEntered(MouseEvent e) {
        Goodstable goodstable = GoodsListFromServerUntil.getStarCardGoods(i);
        if (goodstable != null) {
            ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
        }
    }

    @Override
    public void mouseExited(MouseEvent e) {
        TestpackJframe.getTestpackJframe().getJpac().ClearText();
        ZhuFrame.getZhuJpanel().cleargoodtext();
    }
}
